#!/bin/bash

TRADING_DATE="${1}"
MACHINE="${2}"
MEAR="${3}"
SYMBOL="${4}"

echo "TRADING_DATE=${TRADING_DATE}"
echo "MACHINE=${MACHINE}"
echo "MEAR=${MEAR}"
echo "SYMBOL=${SYMBOL}"

source /remote/iosg/home-8/bot-hft/miniconda3/etc/profile.d/conda.sh
conda activate /remote/iosg/home-8/bot-hft/miniconda3/envs/coin2_motion_env_migration

SRC_FILE="/remote/iosg/coin-2/feed_cache2/${MACHINE}/${TRADING_DATE}/${MEAR}/${SYMBOL}.W0.lz4"
DST_FILE="/remote/iosg/data-2/buckets/feed.derived.json.bbo_price_change/${MACHINE}/${TRADING_DATE}/${MEAR}/${TRADING_DATE}_${MEAR}_${SYMBOL}"
mkdir -p "/remote/iosg/data-2/buckets/feed.derived.json.bbo_price_change/${MACHINE}/${TRADING_DATE}/${MEAR}/"
oriocat --json --proto=fastfeed "${SRC_FILE}" > "${DST_FILE}"

conda deactivate
